home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1988 / Mar 88 / MacApp AppleTalk Error Handling < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.8 KB  |  166 lines  |  [TEXT/GEOL]

  1. Item forwarded  by  N0658        to DTC.AA
  2.  
  3. Item    9808452                         29-March-88        18:29
  4.  
  5. From:   N0658                           ESL, Robert Penland, ASC
  6.  
  7. To:     MACAPP$                         MacApp Interest List
  8.  
  9. Sub:    MacApp AppleTalk ErrorHandling
  10.  
  11. I am still twiddling with the appletalk unit of MacApp, I have
  12. managed to implement the new parameter block calls and get rid of
  13. the network events, but I am still a little curious about what would
  14. be the best way to implement the error codes.  In the original code,
  15. as reproduced below, it is stated the  with the new UObject error
  16. mechanism some of the code could be made more efficient.  What is
  17. meant by this and how would one go about doing it?  Is the new
  18. UObject error mechanism the FailNil and FailOSErr calls or the
  19. Catchfailures/Success procedures?  Also to make things better in
  20. the nodebug case should alerts and dialogs be constructed to handle
  21. all the current WRITELN statement?
  22.  
  23.  
  24.  
  25.  
  26.  
  27.     FUNCTION OpenAppleTalk: OSErr;
  28.  
  29.         VAR err:    OSErr;
  30.  
  31.     BEGIN
  32.  
  33.         WITH gStartStatus DO
  34.  
  35.             BEGIN
  36.  
  37.             theErr := noErr;  {??? can dispense with this if we supplant
  38.  
  39.                                 the error-handling mechanism used}
  40.  
  41.             theSeqNum := 0;   {   in this unit with the new UObject error
  42.  
  43.                                 mechanism}
  44.  
  45.             END;
  46.  
  47.  
  48.  
  49.         err := MPPOpen;     {Open the AppleTalk driver}
  50.  
  51.         IF err = noErr THEN
  52.  
  53.             BEGIN
  54.  
  55.             err := GetNodeAddress(gNode, gNet);
  56.  
  57. {$IFC qDebug}
  58.  
  59.             IF err = noMPPErr THEN
  60.  
  61.                 {??? Need better handling, especially in nondebug case}
  62.  
  63.                 WRITELN('MPPDriver not installed')
  64.  
  65.             ELSE
  66.  
  67.             IF err <> noErr THEN
  68.  
  69.                 {??? Need reasonable response}
  70.  
  71.                 WriteLn('Error from MPPOpen is: ', err:1)
  72.  
  73.             ELSE
  74.  
  75.             IF gExperimenting THEN
  76.  
  77.                 WriteLn('gNode = ', gNode:1, '; gNet = ', gNet:1);
  78.  
  79. {$ENDC}
  80.  
  81.             END
  82.  
  83.         ELSE
  84.  
  85. {$IFC qDebug}
  86.  
  87.             {??? Need reasonable response}
  88.  
  89.             WRITELN('AppleTalk not installed')
  90.  
  91. {$ENDC}
  92.  
  93.             ;  {This semicolon intentionally alone on this line}
  94.  
  95.  
  96.  
  97. {$IFC qDebug}
  98.  
  99.         gDebugNetwork := FALSE;
  100.  
  101.  
  102.  
  103.         gTraceAppleTalkCalls[preCall] := FALSE;
  104.  
  105.         gTraceAppleTalkCalls[postCall] := FALSE;
  106.  
  107.         gTraceAppleTalkCalls[postCompletion] := FALSE;
  108.  
  109. {$ENDC}
  110.  
  111.         gOKAppleTalk := (err = noErr);
  112.  
  113.         OpenAppleTalk := err;
  114.  
  115.     END;
  116.  
  117.  
  118.  
  119. Here is the suggestion to supplant with new error mechanism again.
  120. What is meant by this and what would the new code look like?
  121.  
  122.  
  123.  
  124.     FUNCTION CheckForError(anErrStatus: ErrStatus): BOOLEAN;
  125.  
  126.         {??? Supplant with new error mechanism?}
  127.  
  128.     BEGIN
  129.  
  130.         WITH anErrStatus DO
  131.  
  132.             IF theErr <> noErr THEN
  133.  
  134.                 BEGIN
  135.  
  136. {$IFC qDebug}
  137.  
  138.                 WriteLn('Err: ', theErr:1, ' at SeqNum ', theSeqNum:1, '.');
  139.  
  140.                 ProgramBreak('Error in CheckForError');
  141.  
  142. {$ENDC}
  143.  
  144.                 CheckForError := TRUE;
  145.  
  146.                 END
  147.  
  148.             ELSE
  149.  
  150.                 CheckForError := FALSE;
  151.  
  152.     END;
  153.  
  154.  
  155.  
  156. I would appreciate any feedback you could provide.
  157.  
  158.  
  159.  
  160.                 Thanks,
  161.  
  162.                     Robert Penland
  163.  
  164.  
  165.  
  166.